RandNametoFormat(char* szName, char* FormatName)
{// addr = 0x0804C209
    char[255] NewName;
    int len;
    int i;
    int nLen;
    char _v20;
    char _v24;
    intOrPtr _v28;
    char _v284;
    signed char _v292;
    intOrPtr _v296;
    char* _v300;
    char _v304;
    intOrPtr _v308;
    signed int _v312;
    char* _v328;
    _unknown_ r1;
    _unknown_ r4;
    _unknown_ r5;
    _unknown_ r6;
    _unknown_ _t78;
    signed int _t80;
    _unknown_ _t82;
    signed int _t90;
    _unknown_ _t92;
    _unknown_ _t102;
    _unknown_ _t105;
    _unknown_ _t107;
    _unknown_ _t109;
    signed int _t123;
    signed int _t124;
    _unknown_ _t128;
    _unknown_ _t140;

    _v300 =  &_v284;
    _v304 = 0;
    _t80 = 256;
    if(_t80 >= 4) {
        _v308 = 64;
        _t80 = _v304;
        _push(_v308 << 2);
        _push(_t80);
        _push(_v300);
        memset();
        __esp = __esp + 12;
    }
    L0805EBE0();
    _t123 = _t80;
    _v312 = 954437177;
    _v296 = (_v312 * _t123 >> 32 >> 1) - (_t123 >> 31);
    _v296 = _t123 - (_v296 << 3) + _v296;
    _v28 = _v296 + 3;
    _v24 = 0;
    while(1) {
        _t90 = _v24;
        _t146 = _t90 - _v28;
        if(_t90 >= _v28) {
            break;
        }
        L0805EBE0();
        _t124 = _t90;
        _v312 = 1374389535;
        _v292 = (_v312 * _t124 >> 32 >> 3) - (_t124 >> 31);
        _v292 = _t124 - (_v292 << 2) + _v292 + 0 + ((_v292 << 2) + _v292) * 4;
         *(__ebp + _v24 + -280) = (_v292 & 255) + 97;
        _v24 = _v24 + 1;
    }
    L0806E1B0(__esp,  &_v284, ".");
    _v328 = szName;
     *__esp =  &_v284;
    L0806E1B0(__esp);
    _v20 = 0;
    _v328 = ".";
     *__esp =  &_v284;
    L0806E1B0(__esp);
    _v24 = 0;
    while(1) {
        _t109 = L0806E770(__esp, _t146,  &_v284);
        if(_t109 <= _v24) {
            break;
        }
        __eflags = ( *(__ebp + _v24 + -280) & 255) - 46;
        if(__eflags == 0) {
            goto L7;
        }
L11:
        _v24 = _v24 + 1;
        continue;
L7:
         *FormatName = _v24 - _v20;
        FormatName =  &(FormatName[1]);
        while(1) {
            __eflags = _v20 - _v24;
            if(__eflags >= 0) {
                break;
            }
             *FormatName =  *(__ebp + _v20 + -280) & 255;
            FormatName =  &(FormatName[1]);
            _v20 = _v20 + 1;
        }
        _v20 = _v20 + 1;
        goto L11;
    }
     *FormatName = 0;
    FormatName =  &(FormatName[1]);
    return;
}